import { NgModule } from '@angular/core';
import { AuthGuard } from '../../service/auth-guard.service';
import {Routes, RouterModule} from '@angular/router';
import {AdminComponent} from './admin.component';
import {EditPasswordComponent} from './edit-password/edit-password.component';
import {AccountInfoComponent} from './account-info/account-info.component';
import {EditInfoComponent} from './edit-info/edit-info.component';
import {AddPositionComponent} from './add-position/add-position.component';
import {AuthGuardCompanyService} from '../../service/auth-guard-company.service';
import {PageNotFindComponent} from '../page-not-find/page-not-find.component';
import {EditPositionComponent} from './edit-position/edit-position.component';
import {PositionListComponent} from './position-list/position-list.component';
import {AuthGuardTalentService} from '../../service/auth-guard-talent.service';
import {AddResumeComponent} from './add-resume/add-resume.component';
import {EditResumeComponent} from './edit-resume/edit-resume.component';
import {ResumeDetailsComponent} from './resume-details/resume-details.component';
import {ResumeListComponent} from './resume-list/resume-list.component';
import {ApplicationResultsComponent} from './application-results/application-results.component';
import {ApplicationProcessComponent} from './application-process/application-process.component';

const adminRoutes: Routes = [
  {
    path: 'admin',
    component: AdminComponent,
    canActivate: [AuthGuard],
    children: [
      { path: '', component: AccountInfoComponent },
      { path: 'editPassword', component: EditPasswordComponent },
      { path: 'editInfo', component: EditInfoComponent },
      {
        path: 'company',
        canActivate: [AuthGuardCompanyService],
        children: [
          { path: 'addPosition', component: AddPositionComponent},
          { path: 'editPosition/:id', component: EditPositionComponent},
          { path: 'positionList', component: PositionListComponent},
          { path: 'appProcess', component: ApplicationProcessComponent},
        ]
      },
      {
        path: 'talent',
        canActivate: [AuthGuardTalentService],
        children: [
          { path: 'addResume', component: AddResumeComponent},
          { path: 'editResume/:id', component: EditResumeComponent},
          { path: 'resumeList', component: ResumeListComponent},
          { path: 'appResult', component: ApplicationResultsComponent},
        ]
      },
      { path: 'resumeDetails/:id', component: ResumeDetailsComponent},
    ],
  },
  { path: '**', component: PageNotFindComponent}
];

@NgModule({
  imports: [
    RouterModule.forChild(adminRoutes)
  ],
  exports: [
    RouterModule
  ]
})
export class AdminRoutingModule {}
